package anatex.kea;

import javax.management.openmbean.KeyAlreadyExistsException;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import anatex.domain.Document;
import anatex.kea.genex.GenEx;
import anatex.kea.genex.Genitor;
import anatex.kea.genex.extractor.*;

import java.io.*;
import java.util.Date;

public class Bootstrap {

public static void genEx() {
		
		Long t = new Date().getTime();
		
		new GenEx();
		
		try {
			Genitor g = new Genitor(Document.findDocument(new Long(901)));
			g.doTheEvolution();
		} catch (Exception ex) {
			ex.printStackTrace(System.out);
		}
		
		System.out.println("Exec time is: " + ((new Date().getTime() - t) / 1000) + "secs");
		
//		DocumentText dt = DocumentText.findDocumentText(new Long(5));
//		Extractor e = new Extractor();
//		
//		Parameters p = new Parameters();
//		p.put(Parameters.NUM_PHRASES, new Integer(10));
//		p.put(Parameters.FACTOR_TWO_ONE, new Double(2.5));
//		p.put(Parameters.FACTOR_THREE_ONE, new Double(3.0));
//		p.put(Parameters.MIN_LENGTH_LOW_RANK, new Double(1.5));
//		p.put(Parameters.MIN_RANK_LOW_LENGTH, new Integer(10));
//		p.put(Parameters.FIRST_LOW_THRESH, new Integer(500));
//		p.put(Parameters.FIRST_HIGH_THRESH, new Integer(2000));
//		p.put(Parameters.FIRST_LOW_FACTOR, new Double(7.3));
//		p.put(Parameters.FIRST_HIGH_FACTOR, new Double(0.65));
//		p.put(Parameters.STEM_LENGTH, new Integer(4));
//		p.put(Parameters.SUPPRESS_PROPER, new Integer(0));
//		
//		e.setParameters(p);
//		e.setDocumentText(dt);
//		e.extract();
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {

		//debug
		ApplicationContext appContext = new ClassPathXmlApplicationContext("applicationContext.xml");
		
		//build
//		ApplicationContext appContext = new ClassPathXmlApplicationContext("META-INF/spring/applicationContext.xml");
		
		System.out.println("Hello, console!");
		
		genEx();
	}

}
